from selenium import webdriver
from selenium.webdriver.common.by import By
from base_page.base import BasePage

class LoginPage(BasePage):
    username=(By.XPATH,'//*[@id="app"]/div/div[2]/div[2]/div[2]/div[2]/input')
    pwd = (By.XPATH,'//*[@id="app"]/div/div[2]/div[2]/div[3]/div[2]/input')
    login_el=(By.XPATH,'//*[@id="app"]/div/div[2]/div[2]/div[4]/button')

    url='http://192.168.5.15:8082/#/login'
    def input_username(self,un):
        self.locator(self.username).send_keys(un)

    def input_pwd(self,pwd):
        self.locator(self.pwd).send_keys(pwd)

    def click(self):
        self.locator(self.login_el).click()

    def login(self,un,pwd):
        self.open()
        self.input_username(un)
        self.input_pwd(pwd)
        self.click()
        ##self.quit()

if __name__ == '__main__':
    driver = webdriver.Chrome()
    username='13444444444'
    pwd='gfdz@789'
    lp = LoginPage(driver,LoginPage.url)
    lp.login(username,pwd)
